// 源插件
import React, { Fragment, PureComponent } from 'react';
import {
  DateDiff,
  DateStamp,
  FormatnumberZero,
  Mover,
  NumberDivide,
  getNowFormatDate,
} from '@/function.js';

// 视图插件
import {
  Button,
  Card,
  Checkbox,
  Col,
  DatePicker,
  Divider,
  Form,
  Input,
  message,
  notification,
  Row,
  Switch,
  Collapse, Select,
} from 'antd';

// 外部组件
import PageHeaderWrapper from '@/components/PageHeaderWrapper';
import StandardTablePro from '@/components/UpgradeStandardTable/StandardTablePro';
import { connect } from 'dva';
import _indexOf from 'lodash/indexOf';
import _cloneDeep from 'lodash/cloneDeep';
import _pull from 'lodash/pull';
import ExportJsonExcel from '@/components/XLSXOUT/js-export-excel-custom';

// css OR less预编译器

// 图片
const SelectOption = Select.Option;
const { Panel } = Collapse;
const customPanelStyle = {
  backgroundColor: 'rgba(0,0,0,0)',
  borderRadius: 4,
  marginBottom: 24,
  border: 0,
  overflow: 'hidden',
};
/**
 *  Describe:数据连接
 */

@connect(({ problemPosition }) => ({
  problemPosition,
}))
@Form.create()
class ProblemPosition extends PureComponent {
  componentWillMount() {}

  /**
   *  Describe:当前状态
   */

  state = {
    listLoading: false, // 加载状态
    dataSourceStock: {
      data: [],
      total: [],
      code: 0,
    },
    dataSourceOptionBuy: {
      data: [],
      total: [],
      code: 0,
    },
    dataSourceOptionSell: {
      data: [],
      total: [],
      code: 0,
    },
    dataSourceAQ: {
      data: [],
      total: [],
      code: 0,
    },
    dataSourceDQ: {
      data: [],
      total: [],
      code: 0,
    },
    dataSourceRCN: {
      data: [],
      total: [],
      code: 0,
    },
    select:1,
  };

  sheetItem(dataInfos, dataInfosColumns, sheetName) {
    let res = {};
    const infosTable = [];
    const infosFilter = [];
    const sheetHeader = [];
    const sheetWidth = [];
    if (dataInfosColumns) {
      for (const j in dataInfosColumns) {
        const item = dataInfosColumns[j];
        infosFilter.push(item.title);
        sheetHeader.push(item.title);
        sheetWidth.push({ wpx: 100 });
      }
    }
    if (dataInfos) {
      for (const i in dataInfos) {
        const dataInfosItem = dataInfos[i];
        if (dataInfos) {
          const obj = {};
          for (const j in dataInfosColumns) {
            const cItem = dataInfosColumns[j];
            if (cItem.dataIndex === 'optionType') {
              obj[cItem.title] = { 2: 'Sell Call', 1: 'Sell Put', 3: 'Buy Put', 4: 'Buy Call' }[
                dataInfosItem[cItem.dataIndex]
                ];
            } else {
              obj[cItem.title] = dataInfosItem[cItem.dataIndex];
            }
          }
          infosTable.push(obj);
        }
      }
    }
    res = {
      sheetData: infosTable,
      sheetName,
      sheetFilter: infosFilter,
      sheetHeader,
      columnWidths: sheetWidth,
    };
    return res;
  }

  outXlsx() {
    const {
      dataSourceStock,
      dataSourceOptionBuy,
      dataSourceOptionSell,
      dataSourceAQ,
      dataSourceDQ,
      dataSourceRCN,
      select
    } = this.state;
    const option = {
      fileName:  { 1: '当日', 2: '上周', 3: '历史' }[select]+'表现最差导出',
      datas: [],
    };
    option.datas.push(
      this.sheetItem(dataSourceStock.data, dataSourceStock.columns, dataSourceStock.title)
    );
    option.datas.push(
      this.sheetItem(dataSourceOptionBuy.data, dataSourceOptionBuy.columns, dataSourceOptionBuy.title)
    );
    option.datas.push(
      this.sheetItem(dataSourceOptionSell.data, dataSourceOptionSell.columns, dataSourceOptionSell.title)
    );
    option.datas.push(
      this.sheetItem(dataSourceAQ.data, dataSourceAQ.columns, dataSourceAQ.title)
    );
    option.datas.push(
      this.sheetItem(dataSourceDQ.data, dataSourceDQ.columns, dataSourceDQ.title)
    );
    option.datas.push(
      this.sheetItem(dataSourceRCN.data, dataSourceRCN.columns, dataSourceRCN.title)
    );
    const toExcel = new ExportJsonExcel(option);
    toExcel.saveExcel();
  }

  render() {
    const { select, dataSourceStock, dataSourceOptionBuy, dataSourceOptionSell, dataSourceAQ, dataSourceDQ, dataSourceRCN } = this.state;
    return (
      <PageHeaderWrapper>
        <Card>
          <Select
            style={{ width: 200 }}
            onSelect={this.dataSourceChange.bind(this)}
            defaultValue={select}
          >
            <SelectOption value={1}>当日</SelectOption>
            <SelectOption value={2}>上周</SelectOption>
            <SelectOption value={3}>历史</SelectOption>
          </Select>
          <Button type="primary" style={{ marginLeft: 25 }} onClick={this.outXlsx.bind(this)}>
            导出XLSX
          </Button>
          <br />
          <br />
          <br />
          <StandardTablePro dataSource={dataSourceStock} closeScroll={true} />
          <br />
          <br />
          <StandardTablePro dataSource={dataSourceOptionBuy} closeScroll={true} />
          <br />
          <br />
          <StandardTablePro dataSource={dataSourceOptionSell} closeScroll={true} />
          <br />
          <br />
          <StandardTablePro dataSource={dataSourceAQ} closeScroll={true}/>
          <br />
          <br />
          <StandardTablePro dataSource={dataSourceDQ} closeScroll={true} />
          <br />
          <br />
          <StandardTablePro dataSource={dataSourceRCN} closeScroll={true} />
          <br />
        </Card>
      </PageHeaderWrapper>
    );
  }

  dataSourceChange(value) {
    const { dispatch } = this.props;
    const that = this;
    let  select = value;
    that.setState({
      dataSourceStock: {
        data: [],
        total: [],
        code: 0,
      },
      dataSourceOptionBuy: {
        data: [],
        total: [],
        code: 0,
      },
      dataSourceOptionSell: {
        data: [],
        total: [],
        code: 0,
      },
      dataSourceAQ: {
        data: [],
        total: [],
        code: 0,
      },
      dataSourceDQ: {
        data: [],
        total: [],
        code: 0,
      },
      dataSourceRCN: {
        data: [],
        total: [],
        code: 0,
      },
    });
    dispatch({
      type: 'problemPosition/GetWorstStockOptionTable',
      payload:select?select:1,
      callback: res => {
        // debugger
        const data = res.list;
          let stockColumns=[
            {
              title: '股票代码',
              dataIndex: 'mystock',
              type: 'string',
              width: 110,
              search: true,
              sorter: true,
            },
            {
              title: '日涨跌幅',
              dataIndex: 'gain',
              width: 90,
              type: 'number',
              sorter: true,
              render: (value, row, index) => {
                return (
                  <span style={{ color: value > 0 ? '#389e0d' : '#e1111e' }}>
            {typeof value === 'number' || typeof value === 'string'
              ? NumberDivide(value, 2, '%')
              : null}
          </span>
                );
              },
            },
            {
              title: '持有期涨跌幅',
              dataIndex: 'incomepercent',
              width: 90,
              sorter: true,
              type: 'number',
              render: (value, row, index) => {
                return (
                  <span>
                    {typeof value === 'number' || typeof value === 'string'
                      ? NumberDivide(value, 2, '%')
                      : null}
                  </span>
                );
              },
            },
            {
              title: '持仓市值',
              dataIndex: 'costmoney',
              width: 100,
              type: 'number',
              sorter: true,
              render: (value, row, index) => {
                return (
                  <span>
                    {typeof value === 'number' || typeof value === 'string'
                      ? NumberDivide(value.toString())
                      : null}
                  </span>
                );
              },
            },
            {
              title: '股票敞口%',
              dataIndex: 'stockopen',
              width: 80,
              type: 'number',
              sorter: true,
              render: (value, row, index) => {
                return (
                  <span>
                    {typeof value === 'number' || typeof value === 'string'
                      ? `${NumberDivide(
                        mathService
                          .mul(value, 100)
                          .toFixed(2)
                          .toString()
                      )}%`
                      : null}
                  </span>
                );
              },
            },
            {
              title: '成本价',
              width: 80,
              type: 'number',
              dataIndex: 'costprice',
              sorter: true,
              render: (value, row, index) => {
                return (
                  <span>
                    {typeof value === 'number' || typeof value === 'string'
                      ? NumberDivide(value.toString())
                      : null}
                  </span>
                );
              },
            },
            {
              title: '最新价',
              width: 80,
              type: 'number',
              dataIndex: 'stockprice',
              sorter: true,
              render: (value, row, index) => {
                return (
                  <span>
                    {typeof value === 'number' || typeof value === 'string'
                      ? NumberDivide(value.toString())
                      : null}
                  </span>
                );
              },
            },
            {
              title: '持仓股数',
              dataIndex: 'stocknumber',
              width: 80,
              type: 'number',
              sorter: true,
              render: (value, row, index) => {
                return (
                  <span>
                    {typeof value === 'number' || typeof value === 'string'
                      ? NumberDivide(value.toString())
                      : null}
                  </span>
                );
              },
            },
            {
              title: 'AQ',
              dataIndex: 'aqnum',
              width: 80,
              type: 'number',
              sorter: true,
            },
            {
              title: 'DQ',
              dataIndex: 'dqnum',
              width: 80,
              type: 'number',
              sorter: true,
            },
            {
              title: '实值SP',
              dataIndex: 'realSp',
              width: 80,
              type: 'number',
              sorter: true,
            },
            {
              title: '实值SC',
              dataIndex: 'realSc',
              width: 80,
              type: 'number',
              sorter: true,
            },
            {
              title: '剩余市值/(万)',
              dataIndex: 'lastMarketValue',
              width: 80,
              type: 'number',
              sorter: true,
              render: (value, row, index) => {
                return (
                  <span>
                    {typeof value === 'number'
                      ? NumberDivide(mathService.div(value, 10000), 2)
                      : null}
                  </span>
                );
              },
            },
            {
              title: '剩余数量',
              dataIndex: 'lastNum',
              width: 100,
              type: 'number',
              sorter: true,
              render: (value, row, index) => {
                return (
                  <span>
                    {typeof value === 'number' || typeof value === 'string'
                      ? NumberDivide(value.toString())
                      : null}
                  </span>
                );
              },
            },
            {
              title: '当日盈亏',
              dataIndex: 'thisincome',
              width: 100,
              type: 'number',
              sorter: true,
              render: (tags, record) => {
                if (record.mystock === '股票合计') {
                  return (
                    <span>
                      {typeof tags === 'number' || typeof tags === 'string'
                        ? `${NumberDivide(tags.toString())}/${(
                          (tags / (record.costmoney - tags)) *
                          100
                        ).toFixed(2)}%`
                        : null}
                      {}
                    </span>
                  );
                }
                return (
                  <span>
                    {typeof tags === 'number' || typeof tags === 'string'
                      ? NumberDivide(tags.toString())
                      : null}
                  </span>
                );
              },
            },
          ];
          let stockColumnsDay=[
            {
              title: '股票代码',
              dataIndex: 'mystock',
              type: 'string',
              width: 110,
              search: true,
              sorter: true,
            },
            {
              title: '日涨跌幅',
              dataIndex: 'gain',
              width: 90,
              type: 'number',
              sorter: true,
              render: (value, row, index) => {
                return (
                  <span style={{ color: value > 0 ? '#389e0d' : '#e1111e' }}>
            {typeof value === 'number' || typeof value === 'string'
              ? NumberDivide(value, 2, '%')
              : null}
          </span>
                );
              },
            },
            {
              title: '持有期涨跌幅',
              dataIndex: 'incomepercent',
              width: 90,
              sorter: true,
              type: 'number',
              render: (value, row, index) => {
                return (
                  <span>
                    {typeof value === 'number' || typeof value === 'string'
                      ? NumberDivide(value, 2, '%')
                      : null}
                  </span>
                );
              },
            },
            {
              title: '持仓市值',
              dataIndex: 'costmoney',
              width: 100,
              type: 'number',
              sorter: true,
              render: (value, row, index) => {
                return (
                  <span>
                    {typeof value === 'number' || typeof value === 'string'
                      ? NumberDivide(value.toString())
                      : null}
                  </span>
                );
              },
            },
            {
              title: '股票敞口%',
              dataIndex: 'stockopen',
              width: 80,
              type: 'number',
              sorter: true,
              render: (value, row, index) => {
                return (
                  <span>
                    {typeof value === 'number' || typeof value === 'string'
                      ? `${NumberDivide(
                        mathService
                          .mul(value, 100)
                          .toFixed(2)
                          .toString()
                      )}%`
                      : null}
                  </span>
                );
              },
            },
            {
              title: '昨收价',
              width: 80,
              type: 'number',
              dataIndex: 'yesterday',
              sorter: true,
              render: (value, row, index) => {
                return (
                  <span>
                    {typeof value === 'number' || typeof value === 'string'
                      ? NumberDivide(value.toString())
                      : null}
                  </span>
                );
              },
            },
            {
              title: '最新价',
              width: 80,
              type: 'number',
              dataIndex: 'stockprice',
              sorter: true,
              render: (value, row, index) => {
                return (
                  <span>
                    {typeof value === 'number' || typeof value === 'string'
                      ? NumberDivide(value.toString())
                      : null}
                  </span>
                );
              },
            },
            {
              title: '持仓股数',
              dataIndex: 'stocknumber',
              width: 80,
              type: 'number',
              sorter: true,
              render: (value, row, index) => {
                return (
                  <span>
                    {typeof value === 'number' || typeof value === 'string'
                      ? NumberDivide(value.toString())
                      : null}
                  </span>
                );
              },
            },
            {
              title: 'AQ',
              dataIndex: 'aqnum',
              width: 80,
              type: 'number',
              sorter: true,
            },
            {
              title: 'DQ',
              dataIndex: 'dqnum',
              width: 80,
              type: 'number',
              sorter: true,
            },
            {
              title: '实值SP',
              dataIndex: 'realSp',
              width: 80,
              type: 'number',
              sorter: true,
            },
            {
              title: '实值SC',
              dataIndex: 'realSc',
              width: 80,
              type: 'number',
              sorter: true,
            },
            {
              title: '剩余市值/(万)',
              dataIndex: 'lastMarketValue',
              width: 80,
              type: 'number',
              sorter: true,
              render: (value, row, index) => {
                return (
                  <span>
                    {typeof value === 'number'
                      ? NumberDivide(mathService.div(value, 10000), 2)
                      : null}
                  </span>
                );
              },
            },
            {
              title: '剩余数量',
              dataIndex: 'lastNum',
              width: 100,
              type: 'number',
              sorter: true,
              render: (value, row, index) => {
                return (
                  <span>
                    {typeof value === 'number' || typeof value === 'string'
                      ? NumberDivide(value.toString())
                      : null}
                  </span>
                );
              },
            },
            {
              title: '当日盈亏',
              dataIndex: 'thisincome',
              width: 100,
              type: 'number',
              sorter: true,
              render: (tags, record) => {
                if (record.mystock === '股票合计') {
                  return (
                    <span>
                      {typeof tags === 'number' || typeof tags === 'string'
                        ? `${NumberDivide(tags.toString())}/${(
                          (tags / (record.costmoney - tags)) *
                          100
                        ).toFixed(2)}%`
                        : null}
                      {}
                    </span>
                  );
                }
                return (
                  <span>
                    {typeof tags === 'number' || typeof tags === 'string'
                      ? NumberDivide(tags.toString())
                      : null}
                  </span>
                );
              },
            },
          ];
          let stockColumnsWeek=[
            {
              title: '股票代码',
              dataIndex: 'mystock',
              type: 'string',
              width: 110,
              search: true,
              sorter: true,
            },
            {
              title: '日涨跌幅',
              dataIndex: 'gain',
              width: 90,
              type: 'number',
              sorter: true,
              render: (value, row, index) => {
                return (
                  <span style={{ color: value > 0 ? '#389e0d' : '#e1111e' }}>
            {typeof value === 'number' || typeof value === 'string'
              ? NumberDivide(value, 2, '%')
              : null}
          </span>
                );
              },
            },
            {
              title: '持有期涨跌幅',
              dataIndex: 'incomepercent',
              width: 90,
              sorter: true,
              type: 'number',
              render: (value, row, index) => {
                return (
                  <span>
                    {typeof value === 'number' || typeof value === 'string'
                      ? NumberDivide(value, 2, '%')
                      : null}
                  </span>
                );
              },
            },
            {
              title: '持仓市值',
              dataIndex: 'costmoney',
              width: 100,
              type: 'number',
              sorter: true,
              render: (value, row, index) => {
                return (
                  <span>
                    {typeof value === 'number' || typeof value === 'string'
                      ? NumberDivide(value.toString())
                      : null}
                  </span>
                );
              },
            },
            {
              title: '股票敞口%',
              dataIndex: 'stockopen',
              width: 80,
              type: 'number',
              sorter: true,
              render: (value, row, index) => {
                return (
                  <span>
                    {typeof value === 'number' || typeof value === 'string'
                      ? `${NumberDivide(
                        mathService
                          .mul(value, 100)
                          .toFixed(2)
                          .toString()
                      )}%`
                      : null}
                  </span>
                );
              },
            },
            {
              title: '一周前收盘价',
              width: 80,
              type: 'number',
              dataIndex: 'lastWeekStockPrice',
              sorter: true,
              render: (value, row, index) => {
                return (
                  <span>
                    {typeof value === 'number' || typeof value === 'string'
                      ? NumberDivide(value.toString())
                      : null}
                  </span>
                );
              },
            },
            {
              title: '最新价',
              width: 80,
              type: 'number',
              dataIndex: 'stockprice',
              sorter: true,
              render: (value, row, index) => {
                return (
                  <span>
                    {typeof value === 'number' || typeof value === 'string'
                      ? NumberDivide(value.toString())
                      : null}
                  </span>
                );
              },
            },
            {
              title: '持仓股数',
              dataIndex: 'stocknumber',
              width: 80,
              type: 'number',
              sorter: true,
              render: (value, row, index) => {
                return (
                  <span>
                    {typeof value === 'number' || typeof value === 'string'
                      ? NumberDivide(value.toString())
                      : null}
                  </span>
                );
              },
            },
            {
              title: 'AQ',
              dataIndex: 'aqnum',
              width: 80,
              type: 'number',
              sorter: true,
            },
            {
              title: 'DQ',
              dataIndex: 'dqnum',
              width: 80,
              type: 'number',
              sorter: true,
            },
            {
              title: '实值SP',
              dataIndex: 'realSp',
              width: 80,
              type: 'number',
              sorter: true,
            },
            {
              title: '实值SC',
              dataIndex: 'realSc',
              width: 80,
              type: 'number',
              sorter: true,
            },
            {
              title: '剩余市值/(万)',
              dataIndex: 'lastMarketValue',
              width: 80,
              type: 'number',
              sorter: true,
              render: (value, row, index) => {
                return (
                  <span>
                    {typeof value === 'number'
                      ? NumberDivide(mathService.div(value, 10000), 2)
                      : null}
                  </span>
                );
              },
            },
            {
              title: '剩余数量',
              dataIndex: 'lastNum',
              width: 100,
              type: 'number',
              sorter: true,
              render: (value, row, index) => {
                return (
                  <span>
                    {typeof value === 'number' || typeof value === 'string'
                      ? NumberDivide(value.toString())
                      : null}
                  </span>
                );
              },
            },
            {
              title: '当日盈亏',
              dataIndex: 'thisincome',
              width: 100,
              type: 'number',
              sorter: true,
              render: (tags, record) => {
                if (record.mystock === '股票合计') {
                  return (
                    <span>
                      {typeof tags === 'number' || typeof tags === 'string'
                        ? `${NumberDivide(tags.toString())}/${(
                          (tags / (record.costmoney - tags)) *
                          100
                        ).toFixed(2)}%`
                        : null}
                      {}
                    </span>
                  );
                }
                return (
                  <span>
                    {typeof tags === 'number' || typeof tags === 'string'
                      ? NumberDivide(tags.toString())
                      : null}
                  </span>
                );
              },
            },
          ];
          let optionColumns=[
            {
              title: '期权代码',
              dataIndex: 'optionCode',
              type: 'string',
              width: 110,
              search: true,
            },
            {
              title: '类型',
              dataIndex: 'optionType',
              type: 'string',
              filters: [
                {
                  text: 'SP',
                  value: 1,
                },
                {
                  text: 'SC',
                  value: 2,
                },
                {
                  text: 'BP',
                  value: 3,
                },
                {
                  text: 'BC',
                  value: 4,
                },
              ],
              render: (value, row, index) => {
                let res = '';
                if (value === 1) {
                  res = 'SP';
                }
                if (value === 2) {
                  res = 'SC';
                }
                if (value === 3) {
                  res = 'BP';
                }
                if (value === 4) {
                  res = 'BC';
                }
                return <span>{res}</span>;
              },
            },
            {
              title: '数量',
              dataIndex: 'optionCount',
              width: 75,
              type: 'number',
              sorter: true,
            },
            {
              title: '敞口',
              dataIndex: 'positionSize',
              width: 75,
              type: 'number',
              sorter: true,
            },
            {
              title: '行权价',
              dataIndex: 'strikePrice',
              width: 75,
              type: 'number',
              sorter: true,
            },
            {
              title: '标的收盘价',
              dataIndex: 'stockPrice',
              width: 75,
              type: 'number',
              sorter: true,
            },
            {
              title: '距离执行价',
              dataIndex: 'strikePercent',
              width: 75,
              type: 'number',
              sorter: true,
              render: (value, row, index) => {
                return (
                  <span>
                    {typeof value === 'number' || typeof value === 'string'
                      ? `${NumberDivide(
                        mathService
                          .mul(value, 100)
                          .toFixed(2)
                          .toString()
                      )}%`
                      : null}
                  </span>
                );
              },
            },
            {
              title: '收盘价',
              dataIndex: 'close',
              width: 75,
              type: 'number',
              sorter: true,
            },
            {
              title: '成本价',
              dataIndex: 'premium',
              width: 75,
              type: 'number',
              sorter: true,
            },
            {
              title: '盈利',
              dataIndex: 'profit',
              width: 75,
              type: 'number',
              sorter: true,
            },
            {
              title: '盈利百分比',
              dataIndex: 'profitPercent',
              width: 75,
              type: 'number',
              sorter: true,
              render: (value, row, index) => {
                return (
                  <span>
                    {typeof value === 'number' || typeof value === 'string'
                      ? `${NumberDivide(
                        mathService
                          .mul(value, 100)
                          .toFixed(2)
                          .toString()
                      )}%`
                      : null}
                  </span>
                );
              },
            },
            {
              title: '买入日期',
              dataIndex: 'buyDate',
              width: 110,
              type: 'date',
              sorter: true,
              render: (value, row, index) => {
                return <span>{typeof value === 'string' ? value.split(' ')[0] : ''}</span>;
              },
            },
            {
              title: '有效日期',
              dataIndex: 'expiry',
              width: 110,
              type: 'date',
              sorter: true,
              render: (value, row, index) => {
                return <span>{typeof value === 'string' ? value.split(' ')[0] : ''}</span>;
              },
            },
            {
              title: '时间价值',
              dataIndex: 'timeValue',
              width: 75,
              type: 'number',
              sorter: true,
            },
          ];
          let optionColumnsDay=[
            {
              title: '期权代码',
              dataIndex: 'optionCode',
              type: 'string',
              width: 110,
              search: true,
            },
            {
              title: '类型',
              dataIndex: 'optionType',
              type: 'string',
              filters: [
                {
                  text: 'SP',
                  value: 1,
                },
                {
                  text: 'SC',
                  value: 2,
                },
                {
                  text: 'BP',
                  value: 3,
                },
                {
                  text: 'BC',
                  value: 4,
                },
              ],
              render: (value, row, index) => {
                let res = '';
                if (value === 1) {
                  res = 'SP';
                }
                if (value === 2) {
                  res = 'SC';
                }
                if (value === 3) {
                  res = 'BP';
                }
                if (value === 4) {
                  res = 'BC';
                }
                return <span>{res}</span>;
              },
            },
            {
              title: '数量',
              dataIndex: 'optionCount',
              width: 75,
              type: 'number',
              sorter: true,
            },
            {
              title: '敞口',
              dataIndex: 'positionSize',
              width: 75,
              type: 'number',
              sorter: true,
            },
            {
              title: '行权价',
              dataIndex: 'strikePrice',
              width: 75,
              type: 'number',
              sorter: true,
            },
            {
              title: '标的收盘价',
              dataIndex: 'stockPrice',
              width: 75,
              type: 'number',
              sorter: true,
            },
            {
              title: '距离执行价',
              dataIndex: 'strikePercent',
              width: 75,
              type: 'number',
              sorter: true,
              render: (value, row, index) => {
                return (
                  <span>
                    {typeof value === 'number' || typeof value === 'string'
                      ? `${NumberDivide(
                        mathService
                          .mul(value, 100)
                          .toFixed(2)
                          .toString()
                      )}%`
                      : null}
                  </span>
                );
              },
            },
            {
              title: '收盘价',
              dataIndex: 'close',
              width: 75,
              type: 'number',
              sorter: true,
            },
            {
              title: '昨收价',
              dataIndex: 'premium',
              width: 75,
              type: 'number',
              sorter: true,
            },
            {
              title: '盈利',
              dataIndex: 'profit',
              width: 75,
              type: 'number',
              sorter: true,
            },
            {
              title: '盈利百分比',
              dataIndex: 'profitPercent',
              width: 75,
              type: 'number',
              sorter: true,
              render: (value, row, index) => {
                return (
                  <span>
                    {typeof value === 'number' || typeof value === 'string'
                      ? `${NumberDivide(
                        mathService
                          .mul(value, 100)
                          .toFixed(2)
                          .toString()
                      )}%`
                      : null}
                  </span>
                );
              },
            },
            {
              title: '买入日期',
              dataIndex: 'buyDate',
              width: 110,
              type: 'date',
              sorter: true,
              render: (value, row, index) => {
                return <span>{typeof value === 'string' ? value.split(' ')[0] : ''}</span>;
              },
            },
            {
              title: '有效日期',
              dataIndex: 'expiry',
              width: 110,
              type: 'date',
              sorter: true,
              render: (value, row, index) => {
                return <span>{typeof value === 'string' ? value.split(' ')[0] : ''}</span>;
              },
            },
            {
              title: '时间价值',
              dataIndex: 'timeValue',
              width: 75,
              type: 'number',
              sorter: true,
            },
          ];
          let optionColumnsWeek=[
            {
              title: '期权代码',
              dataIndex: 'optionCode',
              type: 'string',
              width: 110,
              search: true,
            },
            {
              title: '类型',
              dataIndex: 'optionType',
              type: 'string',
              filters: [
                {
                  text: 'SP',
                  value: 1,
                },
                {
                  text: 'SC',
                  value: 2,
                },
                {
                  text: 'BP',
                  value: 3,
                },
                {
                  text: 'BC',
                  value: 4,
                },
              ],
              render: (value, row, index) => {
                let res = '';
                if (value === 1) {
                  res = 'SP';
                }
                if (value === 2) {
                  res = 'SC';
                }
                if (value === 3) {
                  res = 'BP';
                }
                if (value === 4) {
                  res = 'BC';
                }
                return <span>{res}</span>;
              },
            },
            {
              title: '数量',
              dataIndex: 'optionCount',
              width: 75,
              type: 'number',
              sorter: true,
            },
            {
              title: '敞口',
              dataIndex: 'positionSize',
              width: 75,
              type: 'number',
              sorter: true,
            },
            {
              title: '行权价',
              dataIndex: 'strikePrice',
              width: 75,
              type: 'number',
              sorter: true,
            },
            {
              title: '标的收盘价',
              dataIndex: 'stockPrice',
              width: 75,
              type: 'number',
              sorter: true,
            },
            {
              title: '距离执行价',
              dataIndex: 'strikePercent',
              width: 75,
              type: 'number',
              sorter: true,
              render: (value, row, index) => {
                return (
                  <span>
                    {typeof value === 'number' || typeof value === 'string'
                      ? `${NumberDivide(
                        mathService
                          .mul(value, 100)
                          .toFixed(2)
                          .toString()
                      )}%`
                      : null}
                  </span>
                );
              },
            },
            {
              title: '收盘价',
              dataIndex: 'close',
              width: 75,
              type: 'number',
              sorter: true,
            },
            {
              title: '一周期收盘价',
              dataIndex: 'premium',
              width: 75,
              type: 'number',
              sorter: true,
            },
            {
              title: '盈利',
              dataIndex: 'profit',
              width: 75,
              type: 'number',
              sorter: true,
            },
            {
              title: '盈利百分比',
              dataIndex: 'profitPercent',
              width: 75,
              type: 'number',
              sorter: true,
              render: (value, row, index) => {
                return (
                  <span>
                    {typeof value === 'number' || typeof value === 'string'
                      ? `${NumberDivide(
                        mathService
                          .mul(value, 100)
                          .toFixed(2)
                          .toString()
                      )}%`
                      : null}
                  </span>
                );
              },
            },
            {
              title: '买入日期',
              dataIndex: 'buyDate',
              width: 110,
              type: 'date',
              sorter: true,
              render: (value, row, index) => {
                return <span>{typeof value === 'string' ? value.split(' ')[0] : ''}</span>;
              },
            },
            {
              title: '有效日期',
              dataIndex: 'expiry',
              width: 110,
              type: 'date',
              sorter: true,
              render: (value, row, index) => {
                return <span>{typeof value === 'string' ? value.split(' ')[0] : ''}</span>;
              },
            },
            {
              title: '时间价值',
              dataIndex: 'timeValue',
              width: 75,
              type: 'number',
              sorter: true,
            },
          ];
          let AQDQColumns= [
          {
            title: '类型',
            dataIndex: 'type',
            type: 'string',
            width: 70,
            filters: [
              {
                text: 'AQ',
                value: 'AQ',
              },
              {
                text: 'DQ',
                value: 'DQ',
              },
            ],
          },
          {
            title: '银行',
            dataIndex: 'bank',
            width: 75,

            type: 'string',
            filters: [
              {
                text: '瑞银',
                value: '瑞银',
              },
              {
                text: '中银',
                value: '中银',
              },
              {
                text: '花旗',
                value: '花旗',
              },
            ],
          },
          {
            title: '股票',
            dataIndex: 'code',
            type: 'string',


            search: true,
          },
          {
            title: '折扣',
            type: 'number',
            dataIndex: 'discount',
            sorter: true,
            render: (value, row, index) => {
              return value === null ? null : (
                <span>{NumberDivide(mathService.mul(value, 100), 2, '%')}</span>
              );
            },
          },
          {
            title: '开始日期',
            dataIndex: 'sdate',
            width: 110,
            type: 'date',
            sorter: true,
            render: (value, row, index) => {
              return <span>{typeof value === 'string' ? value.split(' ')[0] : ''}</span>;
            },
          },
          {
            title: '结束日期',
            dataIndex: 'edate',
            width: 110,
            type: 'date',
            sorter: true,
            render: (value, row, index) => {
              return <span>{typeof value === 'string' ? value.split(' ')[0] : ''}</span>;
            },
          },
          {
            title: '执行价',
            dataIndex: 'strike',
            type: 'number',
            sorter: true,
          },
          {
            title: 'KO价',
            dataIndex: 'ko',
            type: 'number',
            sorter: true,
          },
          {
            title: '现价',
            dataIndex: 'nowPrice',
            type: 'number',
            sorter: true,
          },
          {
            title: '距执幅度',
            dataIndex: 'toStrikeRate',
            width: 75,
            type: 'number',
            sorter: true,
            render: (value, row, index) => {
              let color = 'rgba(0,0,0,0)';
              if (row.type === 'AQ') {
                if (value < 0.015 && value > 0) {
                  color = 'rgba(255,192,0)';
                }
                if (value < 0) {
                  color = '#ff5d5f';
                }
              }
              if (row.type === 'DQ') {
                if (value > -0.015 && value <= 0) {
                  color = 'rgba(255,192,0)';
                }
                if (value > 0) {
                  color = '#ff5d5f';
                }
              }
              return (
                <div
                  style={{
                    backgroundColor: color,
                    margin: '-11px',
                    borderBottom: '7px solid',
                    borderBottomColor: color,
                    borderTop: '7px solid',
                    borderTopColor: color,
                  }}
                >
                  <span>{NumberDivide(mathService.mul(value, 100), 2, '%')}</span>
                </div>
              );
            },
          },
          {
            title: '距KO幅度',
            dataIndex: 'toKoRate',
            width: 75,
            type: 'number',
            sorter: true,
            render: (value, row, index) => {
              let color = 'rgba(0,0,0,0)';
              if (row.type === 'DQ') {
                if (value < 0.01 && value > 0) {
                  color = 'rgba(255,192,0)';
                }
                if (value < 0) {
                  color = '#ff5d5f';
                }
              }
              if (row.type === 'AQ') {
                if (value > -0.01 && value <= 0) {
                  color = 'rgba(255,192,0)';
                }
                if (value > 0) {
                  color = '#ff5d5f';
                }
              }
              return (
                <div
                  style={{
                    backgroundColor: color,
                    margin: '-11px',
                    borderBottom: '7px solid',
                    borderBottomColor: color,
                    borderTop: '7px solid',
                    borderTopColor: color,
                  }}
                >
                  <span>{NumberDivide(mathService.mul(value, 100), 2, '%')}</span>
                </div>
              );
            },
          },
          {
            title: '敞口(万)',
            dataIndex: 'open',
            type: 'number',
            sorter: true,
            render: (value, row, index) => {
              return <div>{NumberDivide(value, 2)}</div>;
            },
          },
          {
            title: '合约市值 ',
            dataIndex: 'contractMv',
            type: 'number',
            sorter: true,
          },
          {
            title: '初始市值 ',
            dataIndex: 'initMv',
            type: 'number',
            sorter: true,
          },
          {
            title: '市值涨跌额',
            dataIndex: 'chgMv',
            type: 'number',
            sorter: true,
          },
        ];
          let AQDQColumnsDay= [
          {
            title: '类型',
            dataIndex: 'type',
            type: 'string',

            width: 70,
            filters: [
              {
                text: 'AQ',
                value: 'AQ',
              },
              {
                text: 'DQ',
                value: 'DQ',
              },
            ],
          },
          {
            title: '银行',
            dataIndex: 'bank',
            width: 75,

            type: 'string',
            filters: [
              {
                text: '瑞银',
                value: '瑞银',
              },
              {
                text: '中银',
                value: '中银',
              },
              {
                text: '花旗',
                value: '花旗',
              },
            ],
          },
          {
            title: '股票',
            dataIndex: 'code',
            type: 'string',


            search: true,
          },
          {
            title: '折扣',
            type: 'number',
            dataIndex: 'discount',
            sorter: true,
            render: (value, row, index) => {
              return value === null ? null : (
                <span>{NumberDivide(mathService.mul(value, 100), 2, '%')}</span>
              );
            },
          },
          {
            title: '开始日期',
            dataIndex: 'sdate',
            width: 110,
            type: 'date',
            sorter: true,
            render: (value, row, index) => {
              return <span>{typeof value === 'string' ? value.split(' ')[0] : ''}</span>;
            },
          },
          {
            title: '结束日期',
            dataIndex: 'edate',
            width: 110,
            type: 'date',
            sorter: true,
            render: (value, row, index) => {
              return <span>{typeof value === 'string' ? value.split(' ')[0] : ''}</span>;
            },
          },
          {
            title: '执行价',
            dataIndex: 'strike',
            type: 'number',
            sorter: true,
          },
          {
            title: 'KO价',
            dataIndex: 'ko',
            type: 'number',
            sorter: true,
          },
          {
            title: '现价',
            dataIndex: 'nowPrice',
            type: 'number',
            sorter: true,
          },
          {
            title: '距执幅度',
            dataIndex: 'toStrikeRate',
            width: 75,
            type: 'number',
            sorter: true,
            render: (value, row, index) => {
              let color = 'rgba(0,0,0,0)';
              if (row.type === 'AQ') {
                if (value < 0.015 && value > 0) {
                  color = 'rgba(255,192,0)';
                }
                if (value < 0) {
                  color = '#ff5d5f';
                }
              }
              if (row.type === 'DQ') {
                if (value > -0.015 && value <= 0) {
                  color = 'rgba(255,192,0)';
                }
                if (value > 0) {
                  color = '#ff5d5f';
                }
              }
              return (
                <div
                  style={{
                    backgroundColor: color,
                    margin: '-11px',
                    borderBottom: '7px solid',
                    borderBottomColor: color,
                    borderTop: '7px solid',
                    borderTopColor: color,
                  }}
                >
                  <span>{NumberDivide(mathService.mul(value, 100), 2, '%')}</span>
                </div>
              );
            },
          },
          {
            title: '距KO幅度',
            dataIndex: 'toKoRate',
            width: 75,
            type: 'number',
            sorter: true,
            render: (value, row, index) => {
              let color = 'rgba(0,0,0,0)';
              if (row.type === 'DQ') {
                if (value < 0.01 && value > 0) {
                  color = 'rgba(255,192,0)';
                }
                if (value < 0) {
                  color = '#ff5d5f';
                }
              }
              if (row.type === 'AQ') {
                if (value > -0.01 && value <= 0) {
                  color = 'rgba(255,192,0)';
                }
                if (value > 0) {
                  color = '#ff5d5f';
                }
              }
              return (
                <div
                  style={{
                    backgroundColor: color,
                    margin: '-11px',
                    borderBottom: '7px solid',
                    borderBottomColor: color,
                    borderTop: '7px solid',
                    borderTopColor: color,
                  }}
                >
                  <span>{NumberDivide(mathService.mul(value, 100), 2, '%')}</span>
                </div>
              );
            },
          },
          {
            title: '敞口(万)',
            dataIndex: 'open',
            type: 'number',
            sorter: true,
            render: (value, row, index) => {
              return <div>{NumberDivide(value, 2)}</div>;
            },
          },
          {
            title: '合约市值 ',
            dataIndex: 'contractMv',
            type: 'number',
            sorter: true,
          },
          {
            title: '昨收市值 ',
            dataIndex: 'initMv',
            type: 'number',
            sorter: true,
          },
          {
            title: '市值涨跌额',
            dataIndex: 'chgMv',
            type: 'number',
            sorter: true,
          },
        ];
        let AQDQColumnsWeek= [
          {
            title: '类型',
            dataIndex: 'type',
            type: 'string',

            width: 70,
            filters: [
              {
                text: 'AQ',
                value: 'AQ',
              },
              {
                text: 'DQ',
                value: 'DQ',
              },
            ],
          },
          {
            title: '银行',
            dataIndex: 'bank',
            width: 75,

            type: 'string',
            filters: [
              {
                text: '瑞银',
                value: '瑞银',
              },
              {
                text: '中银',
                value: '中银',
              },
              {
                text: '花旗',
                value: '花旗',
              },
            ],
          },
          {
            title: '股票',
            dataIndex: 'code',
            type: 'string',


            search: true,
          },
          {
            title: '折扣',
            type: 'number',
            dataIndex: 'discount',
            sorter: true,
            render: (value, row, index) => {
              return value === null ? null : (
                <span>{NumberDivide(mathService.mul(value, 100), 2, '%')}</span>
              );
            },
          },
          {
            title: '开始日期',
            dataIndex: 'sdate',
            width: 110,
            type: 'date',
            sorter: true,
            render: (value, row, index) => {
              return <span>{typeof value === 'string' ? value.split(' ')[0] : ''}</span>;
            },
          },
          {
            title: '结束日期',
            dataIndex: 'edate',
            width: 110,
            type: 'date',
            sorter: true,
            render: (value, row, index) => {
              return <span>{typeof value === 'string' ? value.split(' ')[0] : ''}</span>;
            },
          },
          {
            title: '执行价',
            dataIndex: 'strike',
            type: 'number',
            sorter: true,
          },
          {
            title: 'KO价',
            dataIndex: 'ko',
            type: 'number',
            sorter: true,
          },
          {
            title: '现价',
            dataIndex: 'nowPrice',
            type: 'number',
            sorter: true,
          },
          {
            title: '距执幅度',
            dataIndex: 'toStrikeRate',
            width: 75,
            type: 'number',
            sorter: true,
            render: (value, row, index) => {
              let color = 'rgba(0,0,0,0)';
              if (row.type === 'AQ') {
                if (value < 0.015 && value > 0) {
                  color = 'rgba(255,192,0)';
                }
                if (value < 0) {
                  color = '#ff5d5f';
                }
              }
              if (row.type === 'DQ') {
                if (value > -0.015 && value <= 0) {
                  color = 'rgba(255,192,0)';
                }
                if (value > 0) {
                  color = '#ff5d5f';
                }
              }
              return (
                <div
                  style={{
                    backgroundColor: color,
                    margin: '-11px',
                    borderBottom: '7px solid',
                    borderBottomColor: color,
                    borderTop: '7px solid',
                    borderTopColor: color,
                  }}
                >
                  <span>{NumberDivide(mathService.mul(value, 100), 2, '%')}</span>
                </div>
              );
            },
          },
          {
            title: '距KO幅度',
            dataIndex: 'toKoRate',
            width: 75,
            type: 'number',
            sorter: true,
            render: (value, row, index) => {
              let color = 'rgba(0,0,0,0)';
              if (row.type === 'DQ') {
                if (value < 0.01 && value > 0) {
                  color = 'rgba(255,192,0)';
                }
                if (value < 0) {
                  color = '#ff5d5f';
                }
              }
              if (row.type === 'AQ') {
                if (value > -0.01 && value <= 0) {
                  color = 'rgba(255,192,0)';
                }
                if (value > 0) {
                  color = '#ff5d5f';
                }
              }
              return (
                <div
                  style={{
                    backgroundColor: color,
                    margin: '-11px',
                    borderBottom: '7px solid',
                    borderBottomColor: color,
                    borderTop: '7px solid',
                    borderTopColor: color,
                  }}
                >
                  <span>{NumberDivide(mathService.mul(value, 100), 2, '%')}</span>
                </div>
              );
            },
          },
          {
            title: '敞口(万)',
            dataIndex: 'open',
            type: 'number',
            sorter: true,
            render: (value, row, index) => {
              return <div>{NumberDivide(value, 2)}</div>;
            },
          },
          {
            title: '合约市值',
            dataIndex: 'contractMv',
            type: 'number',
            sorter: true,
          },
          {
            title: '一周前市值',
            dataIndex: 'initMv',
            type: 'number',
            sorter: true,
          },
          {
            title: '市值涨跌额',
            dataIndex: 'chgMv',
            type: 'number',
            sorter: true,
          },
        ];
        let RCNColumns= [
          {
            title: '编号',
            dataIndex: 'billNumber',
            type: 'string',
            width: 110,
            search:true,
          },
          {
            title: '类型',
            dataIndex: 'name',
            width: 75,
            type: 'string',
            filterAuto:true,
          },
           {
            title: '股票1',
            dataIndex: 'stock1',
            width: 75,
            type: 'string',
          },
           {
            title: '股票2',
            dataIndex: 'stock2',
            width: 75,
            type: 'string',
          },
           {
            title: '股票3',
            dataIndex: 'stock3',
            width: 75,
            type: 'string',
          },
        {
            title: '涨跌幅1',
            dataIndex: 'chg1',
            width: 75,
            type: 'string',
          render: (value, row, index) => {
            return (
              <span>
                    {typeof value === 'number' || typeof value === 'string'
                      ? `${NumberDivide(
                        mathService
                          .mul(value, 100)
                          .toFixed(2)
                          .toString()
                      )}%`
                      : null}
                  </span>
            );
          },
          },
           {
            title: '涨跌幅2',
            dataIndex: 'chg2',
            width: 75,
            type: 'string',
             render: (value, row, index) => {
               return (
                 <span>
                    {typeof value === 'number' || typeof value === 'string'
                      ? `${NumberDivide(
                        mathService
                          .mul(value, 100)
                          .toFixed(2)
                          .toString()
                      )}%`
                      : null}
                  </span>
               );
             },
          },
           {
            title: '涨跌幅3',
            dataIndex: 'chg3',
            width: 75,
            type: 'string',
             render: (value, row, index) => {
               return (
                 <span>
                    {typeof value === 'number' || typeof value === 'string'
                      ? `${NumberDivide(
                        mathService
                          .mul(value, 100)
                          .toFixed(2)
                          .toString()
                      )}%`
                      : null}
                  </span>
               );
             },
          },
          {
            title: '折扣率',
            dataIndex: 'kiDiscountRate',
            type: 'string',
            sorter: true,
          },
          {
            title: 'KI折扣率',
            dataIndex: 'kiDiscountRate',
            type: 'string',
          },
          {
            title: '距离安全垫幅度',
            dataIndex: 'toSaveRateRateMin',
            type: 'string',
            sorter: true,
          },
          {
            title: '票息',
            dataIndex: 'billCoupon',
            type: 'string',
            sorter: true,
          },
          {
            title: '敞口',
            dataIndex: 'marketValueInit',
            type: 'number',
            sorter: true,
          },
   {
            title: '市值',
            dataIndex: 'marketValue',
            type: 'number',
            sorter: true,
          },
          {
            title: '市值涨跌幅',
            dataIndex: 'marketValueChg',
            type: 'number',
            sorter: true,
            render: (value, row, index) => {
              return (
                <span>
                    {typeof value === 'number' || typeof value === 'string'
                      ? `${NumberDivide(
                        mathService
                          .mul(value, 100)
                          .toFixed(2)
                          .toString()
                      )}%`
                      : null}
                  </span>
              );
            },
          },
          {
            title: '发行日',
            dataIndex: 'discoveryDate',
            type: 'date',
            sorter: true,
            render: (value, row, index) => {
              return <span>{typeof value === 'string' ? value.split(' ')[0] : ''}</span>;
            },
          },
          {
            title: '比价日',
            dataIndex: 'finalPriceDate',
            type: 'date',
            sorter: true,
            render: (value, row, index) => {
              return <span>{typeof value === 'string' ? value.split(' ')[0] : ''}</span>;
            },
          },
        ];
          let RCNColumnsDay=[
            {
              title: '编号',
              dataIndex: 'billNumber',
              type: 'string',
              width: 110,
              search:true,
            },
            {
              title: '类型',
              dataIndex: 'name',
              width: 75,
              type: 'string',
              filterAuto:true,
            },
            {
              title: '股票1',
              dataIndex: 'stock1',
              width: 75,
              type: 'string',
            },
            {
              title: '股票2',
              dataIndex: 'stock2',
              width: 75,
              type: 'string',
            },
            {
              title: '股票3',
              dataIndex: 'stock3',
              width: 75,
              type: 'string',
            },
            {
              title: '涨跌幅1',
              dataIndex: 'chg1',
              width: 75,
              type: 'string',
              render: (value, row, index) => {
                return (
                  <span>
                    {typeof value === 'number' || typeof value === 'string'
                      ? `${NumberDivide(
                        mathService
                          .mul(value, 100)
                          .toFixed(2)
                          .toString()
                      )}%`
                      : null}
                  </span>
                );
              },
            },
            {
              title: '涨跌幅2',
              dataIndex: 'chg2',
              width: 75,
              type: 'string',
              render: (value, row, index) => {
                return (
                  <span>
                    {typeof value === 'number' || typeof value === 'string'
                      ? `${NumberDivide(
                        mathService
                          .mul(value, 100)
                          .toFixed(2)
                          .toString()
                      )}%`
                      : null}
                  </span>
                );
              },
            },
            {
              title: '涨跌幅3',
              dataIndex: 'chg3',
              width: 75,
              type: 'string',
              render: (value, row, index) => {
                return (
                  <span>
                    {typeof value === 'number' || typeof value === 'string'
                      ? `${NumberDivide(
                        mathService
                          .mul(value, 100)
                          .toFixed(2)
                          .toString()
                      )}%`
                      : null}
                  </span>
                );
              },
            },
            {
              title: '折扣率',
              dataIndex: 'kiDiscountRate',
              type: 'string',
              sorter: true,
            },
            {
              title: 'KI折扣率',
              dataIndex: 'kiDiscountRate',
              type: 'string',
            },
            {
              title: '距离安全垫幅度',
              dataIndex: 'toSaveRateRateMin',
              type: 'string',
              sorter: true,
            },
            {
              title: '票息',
              dataIndex: 'billCoupon',
              type: 'string',
              sorter: true,
            },
            {
              title: '昨日市值',
              dataIndex: 'marketValueInit',
              type: 'number',
              sorter: true,
            },
            {
              title: '市值',
              dataIndex: 'marketValue',
              type: 'number',
              sorter: true,
            },
            {
              title: '市值涨跌幅',
              dataIndex: 'marketValueChg',
              type: 'number',
              sorter: true,
              render: (value, row, index) => {
                return (
                  <span>
                    {typeof value === 'number' || typeof value === 'string'
                      ? `${NumberDivide(
                        mathService
                          .mul(value, 100)
                          .toFixed(2)
                          .toString()
                      )}%`
                      : null}
                  </span>
                );
              },
            },
            {
              title: '发行日',
              dataIndex: 'discoveryDate',
              type: 'date',
              sorter: true,
              render: (value, row, index) => {
                return <span>{typeof value === 'string' ? value.split(' ')[0] : ''}</span>;
              },
            },
            {
              title: '比价日',
              dataIndex: 'finalPriceDate',
              type: 'date',
              sorter: true,
              render: (value, row, index) => {
                return <span>{typeof value === 'string' ? value.split(' ')[0] : ''}</span>;
              },
            },
          ];
          let RCNColumnsWeek= [
            {
              title: '编号',
              dataIndex: 'billNumber',
              type: 'string',
              width: 110,
              search:true,
            },
            {
              title: '类型',
              dataIndex: 'name',
              width: 75,
              type: 'string',
              filterAuto:true,
            },
            {
              title: '股票1',
              dataIndex: 'stock1',
              width: 75,
              type: 'string',
            },
            {
              title: '股票2',
              dataIndex: 'stock2',
              width: 75,
              type: 'string',
            },
            {
              title: '股票3',
              dataIndex: 'stock3',
              width: 75,
              type: 'string',
            },
            {
              title: '涨跌幅1',
              dataIndex: 'chg1',
              width: 75,
              type: 'string',
              render: (value, row, index) => {
                return (
                  <span>
                    {typeof value === 'number' || typeof value === 'string'
                      ? `${NumberDivide(
                        mathService
                          .mul(value, 100)
                          .toFixed(2)
                          .toString()
                      )}%`
                      : null}
                  </span>
                );
              },
            },
            {
              title: '涨跌幅2',
              dataIndex: 'chg2',
              width: 75,
              type: 'string',
              render: (value, row, index) => {
                return (
                  <span>
                    {typeof value === 'number' || typeof value === 'string'
                      ? `${NumberDivide(
                        mathService
                          .mul(value, 100)
                          .toFixed(2)
                          .toString()
                      )}%`
                      : null}
                  </span>
                );
              },
            },
            {
              title: '涨跌幅3',
              dataIndex: 'chg3',
              width: 75,
              type: 'string',
              render: (value, row, index) => {
                return (
                  <span>
                    {typeof value === 'number' || typeof value === 'string'
                      ? `${NumberDivide(
                        mathService
                          .mul(value, 100)
                          .toFixed(2)
                          .toString()
                      )}%`
                      : null}
                  </span>
                );
              },
            },
            {
              title: '折扣率',
              dataIndex: 'kiDiscountRate',
              type: 'string',
              sorter: true,
            },
            {
              title: 'KI折扣率',
              dataIndex: 'kiDiscountRate',
              type: 'string',
            },
            {
              title: '距离安全垫幅度',
              dataIndex: 'toSaveRateRateMin',
              type: 'string',
              sorter: true,
            },
            {
              title: '票息',
              dataIndex: 'billCoupon',
              type: 'string',
              sorter: true,
            },
            {
              title: '一周前市值',
              dataIndex: 'marketValueInit',
              type: 'number',
              sorter: true,
            },
            {
              title: '市值',
              dataIndex: 'marketValue',
              type: 'number',
              sorter: true,
            },
            {
              title: '市值涨跌幅',
              dataIndex: 'marketValueChg',
              type: 'number',
              sorter: true,
              render: (value, row, index) => {
                return (
                  <span>
                    {typeof value === 'number' || typeof value === 'string'
                      ? `${NumberDivide(
                        mathService
                          .mul(value, 100)
                          .toFixed(2)
                          .toString()
                      )}%`
                      : null}
                  </span>
                );
              },
            },
            {
              title: '发行日',
              dataIndex: 'discoveryDate',
              type: 'date',
              sorter: true,
              render: (value, row, index) => {
                return <span>{typeof value === 'string' ? value.split(' ')[0] : ''}</span>;
              },
            },
            {
              title: '比价日',
              dataIndex: 'finalPriceDate',
              type: 'date',
              sorter: true,
              render: (value, row, index) => {
                return <span>{typeof value === 'string' ? value.split(' ')[0] : ''}</span>;
              },
            },
          ];


        that.setState({
          select:value,
          dataSourceStock: {
            title: (value === 1?'当日最差表现股票':value === 2?'上周最差表现股票':value === 3?'历史最差表现股票':''),
            columns:(value === 1?stockColumnsDay:value === 2?stockColumnsWeek:value === 3?stockColumns:[]),
            data: data.worstStockTable,
            total: [],
            code: 1,
          },
          dataSourceOptionBuy: {
            title: value === 1?'当日最差表现期权BUY':value === 2?'上周最差表现期权BUY':value === 3?'历史最差表现期权BUY':'',
            columns:value === 1?optionColumnsDay:value === 2?optionColumnsWeek:value === 3?optionColumns:[],
            data: data.buyOption ,
            total: [],
            code: 1,
          },
           dataSourceOptionSell: {
            title: value === 1?'当日最差表现期权SELL':value === 2?'上周最差表现期权SELL':value === 3?'历史最差表现期权SELL':'',
            columns:value === 1?optionColumnsDay:value === 2?optionColumnsWeek:value === 3?optionColumns:[],
            data: data.sellOption ,
            total: [],
            code: 1,
          },
          dataSourceAQ: {
            title: value === 1?'当日最差表现AQ':value === 2?'上周最差表现AQ':value === 3?'历史最差表现AQ':'',
            columns:value === 1?AQDQColumnsDay:value === 2?AQDQColumnsWeek:value === 3?AQDQColumns:[],
            data: data.aqBad10s  ,
            total: [],
            code: 1,
          },
          dataSourceDQ: {
            title: value === 1?'当日最差表现DQ':value === 2?'上周最差表现DQ':value === 3?'历史最差表现DQ':'',
            columns:value === 1?AQDQColumnsDay:value === 2?AQDQColumnsWeek:value === 3?AQDQColumns:[],
            data: data.dqBad10s  ,
            total: [],
            code: 1,
          },
          dataSourceRCN: {
            title: value === 1?'当日最差表现RCN':value === 2?'上周最差表现RCN':value === 3?'历史最差表现RCN':'',
            columns:value === 1?RCNColumnsDay:value === 2?RCNColumnsWeek:value === 3?RCNColumns:[],
            data:data.billBad10s,
            total: [],
            code: 1,
          },
        });
      },
    });
  }

  componentDidMount() {
    this.dataSourceChange(1);
  }

  componentWillUnmount() {}
}

export default ProblemPosition;
